import java.awt.*;
import javax.swing.*;
/*
 * Created by JFormDesigner on Wed Jun 06 17:50:42 PDT 2012
 */



/**
 * @author David Jaenisch
 */
public class ConceptFrame extends JFrame {
	public ConceptFrame() {
		initComponents();
		setStoryPanel(new StoryPanel(new StoryArchive().findStory()));
	}

	private void initComponents() {
		// JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
		// Generated using JFormDesigner Evaluation license - David Jaenisch
		appPanel = new JPanel();
		storyPanel = new StoryPanel();

		//======== this ========
		setVisible(true);
		Container contentPane = getContentPane();
		contentPane.setLayout(null);

		//======== appPanel ========
		{

			// JFormDesigner evaluation mark
			appPanel.setBorder(new javax.swing.border.CompoundBorder(
				new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
					"JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
					javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
					java.awt.Color.red), appPanel.getBorder())); appPanel.addPropertyChangeListener(new java.beans.PropertyChangeListener(){public void propertyChange(java.beans.PropertyChangeEvent e){if("border".equals(e.getPropertyName()))throw new RuntimeException();}});

			appPanel.setLayout(new BorderLayout());
			appPanel.add(storyPanel, BorderLayout.CENTER);
		}
		contentPane.add(appPanel);
		appPanel.setBounds(new Rectangle(new Point(0, 0), appPanel.getPreferredSize()));

		{ // compute preferred size
			Dimension preferredSize = new Dimension();
			for(int i = 0; i < contentPane.getComponentCount(); i++) {
				Rectangle bounds = contentPane.getComponent(i).getBounds();
				preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
				preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
			}
			Insets insets = contentPane.getInsets();
			preferredSize.width += insets.right;
			preferredSize.height += insets.bottom;
			contentPane.setMinimumSize(preferredSize);
			contentPane.setPreferredSize(preferredSize);
		}
		pack();
		setLocationRelativeTo(getOwner());
		// JFormDesigner - End of component initialization  //GEN-END:initComponents
	}
	
	public void setStoryPanel(final StoryPanel storyPanel){
				if(this.storyPanel != null){
					appPanel.remove(this.storyPanel);
				}
				this.storyPanel = storyPanel;
				storyPanel.setBounds(0,0,900,900);
				appPanel.add(storyPanel);
				

	}

	// JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
	// Generated using JFormDesigner Evaluation license - David Jaenisch
	private JPanel appPanel;
	private StoryPanel storyPanel;
	// JFormDesigner - End of variables declaration  //GEN-END:variables
}
